package org.carabiner.example;

import javax.swing.Action;

import org.jmock.Mock;
import org.jmock.MockObjectTestCase;

public class TestSquareAction extends MockObjectTestCase
{
  private AddSquareAction action;

  protected void tearDown() throws Exception
  {
    super.tearDown();
  }
  
  public void testAction()
  {        
    Mock mockView = new Mock(View.class);
    mockView.expects(once()).method("getShapeModel");
    mockView.expects(once()).method("addMouseListener").with(isA(SquareMouseController.class));
    action = new AddSquareAction((View)mockView.proxy());
    assertEquals("Square", action.getValue(Action.NAME));
    
    action.actionPerformed(null);    
    mockView.verify();
  }

}
